<?php

/*
 *  This is NOT a freeware, use is subject to license terms
 *  @author: hzq <151680523@qq.com>

 * @version     $Id:filename.php
 */

class file extends model {

    function home() {
        $up = new upload('images', 1024 * 1024 * 1024);
        $up->doUpload('imgFile', 600);

        if ($up->err) {
            alert(iconv('gbk', 'utf-8', $up->err));
        }

        header('Content-type: text/html; charset=UTF-8');


        $attid = SQLS::inserts(array("path" => $up->sucess[0]),'attachment');
        $json = new servicesJSON();
        echo $json->encode(array('error' => 0, 'url' => '/' . $up->sucess[0], "attid" => $attid));
        exit;
    }

}

function alert($msg) {
    header('Content-type: text/html; charset=utf-8');
    $json = new servicesJSON();
    echo $json->encode(array('error' => 1, 'message' => $msg));
    exit;
}

?>
